<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>编辑字段</title>
	<hdjs />
	<js file='__PUBLIC__/Js/mod.field.js' />
	<css file="__PUBLIC__/Css/mod.base.css" />
	<script type="text/javascript">
		$(function(){
			$('#validate').change(function(){
				$(this).siblings().val($(this).val());
			})
		})
	</script>
</head>
<body>
	<form action="" method="post" class='hd-form'>

		
		<div class="hd-menu-list">
			<ul>
				<li>
					<a  href="{:U('Model/index',array('mid'=>$_GET['mid']))}">
						模型列表
					</a>
				</li>

				<li>
					<a  href="{:U('Field/index',array('mid'=>$_GET['mid']))}">
						字段列表
					</a>
				</li>

				<li class='active'>
					<a href="javascript:;" >
						编辑字段
					</a>
				</li>

				<li>
					<a href="{:U('Field/update_cache',array('mid'=>$_GET['mid']))}">
						更新缓存
					</a>
				</li>
			</ul>
		</div>
		<div class="hd-title-header">
            添加字段
        </div>
		<table class="hd-table hd-table-form hd-form">
			<tr>
				<th class="hd-hd-w100">模型</th>
				<td>{$modelName}</td>
			</tr>
			<tr>
				<th>字段标题</th>
				<td><input type="text" name='title' class='hd-w200' value="{$field.title}" /></td>
			</tr>
			<tr>
				<th>字段名</th>
				<td><input type="text" name='fname' class='hd-w200' value="{$field.fname}"/></td>
			</tr>
			<tr>
				<th>排序</th>
				<td>
					<input type="text" name="sort" class="hd-w200" value="{$field.sort}" />
				</td>
			</tr>
			<!-- 1 文本 ，2多行文本 ，3 编辑器 4简单编辑器 ，5 单选框 ，6下拉框，7多选框 ，8文件上传框，9图片上传框 ， 10地区联动 -->
			<tr>
				<th class="hd-w100">字段类型</th>
				<td>
					<select name="show_type" >
						<option value="1" <if condition="$field['show_type'] eq '1'">selected='selected'</if>>文本</option>
						<option value="2" <if condition="$field['show_type'] eq '2'">selected='selected'</if>>多行文本</option>
						<option value="3" <if condition="$field['show_type'] eq '3'">selected='selected'</if>>编辑器</option>
						<option value="4" <if condition="$field['show_type'] eq '4'">selected='selected'</if>>简单编辑器</option>
						<option value="5" <if condition="$field['show_type'] eq '5'">selected='selected'</if>>单选框</option>
						<option value="6" <if condition="$field['show_type'] eq '6'">selected='selected'</if>>下拉框</option>
						<option value="7" <if condition="$field['show_type'] eq '7'">selected='selected'</if>>多选框</option>
						<option value="8" <if condition="$field['show_type'] eq '8'">selected='selected'</if>>文件上传框</option>
						<option value="9" <if condition="$field['show_type'] eq '9'">selected='selected'</if>>图片上传框</option>
						<!-- <option value="10">地区联动</option> -->
					</select>
				</td>
			</tr>
			<tr>
				<th>验证规则</th>
				<td>
					<input type="text" class='hd-w200' name='validate' value="{$field.validate}" />
					<select  id="validate" class='h30'>
						<option value="">验证规则</option>
						<option value="/^\d+$/">数字</option>
						<option value="/^([a-zA-Z0-9_\-\.])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/i">邮箱</option>
						<option value="/^\d{11}$/">手机</option>
						<option value="/(?:\(\d{3,4}\)|\d{3,4}-?)\d{8}/">固定电话</option>
					</select>
				</td>
			</tr>
			<tr>
				<th>不通过提示</th>
				<td><input type="text" value="{$field.error}" name="error" class="hd-w200"  /></td>
			</tr>
			<tr>
				<th>是否列表显示</th>
				<td>
					<label><input type="radio" value="1" name='show_lists' <if condition="$field['show_lists']">checked="checked"</if> /> 是</label>
					<label><input type="radio" value="0" name='show_lists' <if condition="!$field['show_lists']">checked="checked"</if> /> 否</label>
				</td>
			</tr>
			<tr>
				<th>是否必填</th>
				<td>
					<label><input type="radio" value="1" <if condition="$field['require']">checked="checked"</if> name='require'/> 是</label>
					<label><input type="radio" value="0" <if condition="!$field['require']">checked="checked"</if> name='require' /> 否</label>
				</td>
			</tr>
			<tr>
				<th>是否禁用</th>
				<td>
					<label><input type="radio" value="1" name='is_disabled' <if condition="$field['is_disabled']">checked="checked"</if> name='require'/> 是</label>
					<label><input type="radio" value="0" name='is_disabled' <if condition="!$field['is_disabled']">checked="checked"</if> name='require'/> 否</label>
				</td>
			</tr>
			<tr>
				<th>默认值</th>
				<td>
					<div class="single">
						<table class="table2">
							<tr>
								<td>
									<input type="text" name="field_value[{$field.field_value.0.fv_id}-0]" class='hd-w200' value="{$field.field_value.0.field_value}" />
								</td>
							</tr>
						</table>
					</div>
					<div class="multiply">
						<table class="table2">
							<foreach name='field.field_value' item='v'>
							<tr>
								<td>
									<input type="text" name="field_value[{$v.fv_id}-{$key}]" class='hd-w200' value="{$v.field_value}"/>
									<if condition='!$key'>
									<span class='field_add'>添加值</span>
									<else />
									<span class='field_reduce'>删除值</span>
									</if>
								</td>
							</tr>
							</foreach>
						</table>
					</div>
				</td>
			</tr>
		</table>
	
		

	<div class="hd-position-bottom">
		<input type="submit" class='hd-btn-primary hd-btn' value="编辑" />
		<input type="hidden" name='mid' value='{$Think.get.mid}'  />
		<input type="hidden" name='fid' value='{$Think.get.fid}'  />
		<input type="button" class="hd-btn" onclick="location.href='{:U('Field/index',array('mid'=>$_GET['mid']))}'" value="返回"/>	
	</div>
	</form>
</body>
</html>